#ifndef _SIGN_ALI_H_
#define _SIGN_ALI_H_

#include <stdarg.h>
#include <stdbool.h>
#include "sign_api.h"  //包含签名所需的各种数据结构定义

//#include "config.h"

struct ali_topic
{
    char topic_pub_post[512];
    char topic_sub_post_reply[512];
    char topic_sub_set[512];
    char topic_sub_get[512];
    char topic_pub_ota_infor[512];
    char topic_sub_ota_update[512];
    char topic_pub_ota_pgs[512];
};


//下面的几个宏用于定义设备的阿里云身份认证信息：ProductKey、ProductSecret、DeviceName、DeviceSecret
//在实际产品开发中，设备的身份认证信息应该是设备厂商将其加密后存放于设备Flash中或者某个文件中，
//设备上电时将其读出后使用
//#define EXAMPLE_PRODUCT_KEY     "a1o2hi2s82Q"
//#define EXAMPLE_PRODUCT_SECRET    PROD_SECRET
//#define EXAMPLE_DEVICE_NAME     "soil_sensor1"
//#define EXAMPLE_DEVICE_SECRET   "508eacb7892d3468015bb444c027b6e2"

//#define ALINK_TOPIC_PROP_POST     "/sys/" EXAMPLE_PRODUCT_KEY "/" EXAMPLE_DEVICE_NAME "/thing/event/property/post"
#define ALINK_TOPIC_PROP_POSTRSP  "/sys/%s/%s/thing/event/property/post_reply"
//#define ALINK_TOPIC_PROP_SET      "/sys/" EXAMPLE_PRODUCT_KEY "/" EXAMPLE_DEVICE_NAME "/thing/service/property/set"
#define ALINK_METHOD_PROP_POST    "thing.event.property.post"
//#define ALINK_TOPIC_DEV_INFO      "/ota/device/inform/" EXAMPLE_PRODUCT_KEY "/" EXAMPLE_DEVICE_NAME ""
#define ALINK_TOPIC_PUB           "/sys/%s/%s/thing/event/property/post"
//#define ALINK_TOPIC_SUB           "/sys/%s/%s//thing/event/property/post_reply"

#define ALINK_TOPIC_SUB_SET       "/sys/%s/%s/thing/service/property/set"
#define ALINK_TOPIC_SUB_GET       "/sys/%s/%s/thing/config/get"
 //                                      /sys/a1OB6Gt6Awe/motor1/thing/service/property/set
//#define ALINK_TOPIC_PUB_SET_REPLY   "/sys/" EXAMPLE_PRODUCT_KEY "/" EXAMPLE_DEVICE_NAME "/thing/service/property/set_reply"
//#define ALINK_TOPIC_PUB_GET_REPLY   "/sys/" EXAMPLE_PRODUCT_KEY "/" EXAMPLE_DEVICE_NAME "/thing/config/get_reply"

//#define ALINK_TOPIC_ALARM_POST      "/sys/" EXAMPLE_PRODUCT_KEY "/" EXAMPLE_DEVICE_NAME "/thing/event/SOIL_ALARM/post"

///a19mzPZ****/device1/user/update

#define ALINK_TOPIC_OTA_INFO_PUB       "/ota/device/inform/%s/%s"
#define ALINK_TOPIC_OTA_UPDATE_SUB     "/ota/device/upgrade/%s/%s"
#define ALINK_TOPIC_OTA_PGS_PUB        "/ota/device/progress/%s/%s"

void do_iotx_sign_mqtt(iotx_mqtt_region_types_t region,
                        iotx_sign_mqtt_t *sign_mqtt,
                        struct ali_topic *topic,
                        char *pkey,char *dev_name,
                        char *psecret,char *dsecret );

void do_iotx_sign_regnwl_mqtt(iotx_mqtt_region_types_t region,
                        iotx_sign_mqtt_t *sign_mqtt,
                        char *pkey,char *dev_name,
                        char *psecret);

void do_iotx_sign_connwl_mqtt(iotx_mqtt_region_types_t region,
                        iotx_sign_mqtt_t *sign_mqtt,
                        struct ali_topic *topic,
                        char *pkey,char *dev_name,
                        char *psecret,char *token,char *client_id );

#endif
